package ${basePackage}.pojo;

<#if enableGenerateDoc>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
</#if>
import lombok.Data;
import java.io.Serializable;
<#if haveBigDecimal>
import java.math.BigDecimal;
</#if>
<#if haveDate>
import java.util.Date;
</#if>
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

/**
 * @描述: ${comment}【新增时使用】
 * @作者: ${author}
 * @创建时间: ${createTime}
 * @所属公司: ${company}
 */
<#if enableGenerateDoc>
@ApiModel(value = "${comment}【新增时使用】")
</#if>
@Data
public class Add${className}POJO implements Serializable {
private static final long serialVersionUID = 1L;
<#if (pkColumns?size > 1)>
    <#list pkColumns as pkColumn>
    /**
     * ${pkColumn.columnComment}
     */
    @NotNull(message = "${pkColumn.attrName}不能为空")
    @ApiModelProperty(value = "${pkColumn.columnComment}<#if pkColumn.characterMaximumLength??>【允许最大长度：${pkColumn.characterMaximumLength}】</#if>", dataType = "${pkColumn.fullAttrType}", example = "${pkColumn.example}", required = true)
    private ${pkColumn.attrType} ${pkColumn.attrName};
    </#list>
</#if>
<#list columns as column>
    <#if (column.columnKey == "PRI" || column.attrName == "createBy" || column.attrName =="createUser" || column.attrName == "updateBy" || column.attrName == "updateUser" || column.attrName == "createAt" || column.attrName == "createTime" || column.attrName == "createDate" || column.attrName == "updateAt" || column.attrName == "updateTime" || column.attrName == "updateDate" || column.attrName == "valid")>
    <#else>
    /**
     * ${column.columnComment}
     */
        <#if (column.required)>
            <#if (column.attrType == "String" && column.columnDefault?? && column.columnDefault == "")>
            <#else>
    @NotNull(message = "${column.attrName}不能为空")
            </#if>
            <#if (column.attrType == "String")>
                <#if (column.attrName == "phone" || column.attrName == "mobile")>
    @IsMobile
                <#elseif (column.attrName == "idCardNo")>
    @IsChinaIDCardNo
                <#elseif (column.attrName == "email")>
    @IsEmail
                <#else>
                </#if>
            </#if>
        </#if>
        <#if (column.characterMaximumLength)??>
    @Length(min = 0, max = ${column.characterMaximumLength})
        </#if>
        <#if (column.attrType == "Integer" && column.attrName == "sex")>
    @Range(min = 1, max = 2)
        </#if>
        <#if enableGenerateDoc>
            <#if (column.required)>
                <#if (column.attrType == "String" && column.columnDefault?? && column.columnDefault == "")>
    @ApiModelProperty(value = "${column.columnComment}<#if column.characterMaximumLength??>【允许最大长度：${column.characterMaximumLength}】</#if>", dataType = "${column.fullAttrType}", example = "${column.example}", required = false)
                <#else>
    @ApiModelProperty(value = "${column.columnComment}<#if column.characterMaximumLength??>【允许最大长度：${column.characterMaximumLength}】</#if>", dataType = "${column.fullAttrType}", example = "${column.example}", required = true)
                </#if>
            <#else>
    @ApiModelProperty(value = "${column.columnComment}<#if column.characterMaximumLength??>【允许最大长度：${column.characterMaximumLength}】</#if>", dataType = "${column.fullAttrType}", example = "${column.example}", required = false)
            </#if>
        </#if>
    private ${column.attrType} ${column.attrName};
    </#if>
</#list>
}
